How to set up a simple minecraft server (java):

Minecraft (we do not own this game) is a popular sandbox video game that has a huge communities of regular players, modders and server creators. And as part of the many features in this game, players of like-minded communities can create their own servers and can play together!


In this article you will learn how to install all the stuff you need to run minecraft on a linux-based system. You will also learn more about basic configuration and deployment.


This guide is not meant to be an in-depth guide and assumes that you may already have some knowledge about minecraft and linux!

Prerequisites:

Before you begin, check that you have all the stuff you need!


For the sake of this tutorial, we will be using ubuntu for demonstration!

Package Installation:

To start, we need to install java. In the case of ubuntu, you will need to add a PPA:


sudo add-apt-repository ppa:openjdk-r/ppa


After adding the PPA, you need to update the package sources, like so:


sudo apt update


After that, install java and screen (I have also added some other packages in case ubuntu does not include them):


sudo apt install openjdk-17-jre-headless screen unzip wget


Firewall Configuration:

Minecraft servers operate on tcp with the port 25565, which means you need to open it up!


sudo ufw allow 25565


Installing the server package:

There are many popular server variants out there, for example: papermc, vanilla and more! However, I personally prefer paper as it is flexible and optimized for servers and I never had issues using it!


wget https://api.papermc.io/v2/projects/paper/versions/1.20.6/builds/147/downloads/paper-1.20.6-147.jar


For me I usually like to put this inside a specific folder

mkdir minecraftServer && mv paper-1.20.6-147.jar minecraftServer && cd minecraftServer


Next, you need to execute the runtime!


screen -S minecraft


java -Xms1024M -Xmx1024M -jar paper-1.20.6-147.jar nogui


What this does is that it creates a detached screen session so that even when you close the terminal, you can still have the server up and running!


Here is a simple breakdown of what the command that we used to start the server means

EULA

In the console, you will see a error saying that you need to update the EULA, this is the End User License Agreement and you need to agree to the terms before you can continue using it, to agree, open the file in your favourite text editor and change false to TRUE

nano eula.txt


Final result:

eula=TRUE


Once you are done, re-run the runtime and you should have a server up and running!

Notes